package kr.co.redcircle.broker.utility;

import java.util.HashMap;

import kr.co.redcircle.broker.Broker;
import kr.co.redcircle.broker.io.BrokerRequest;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;

public class JsonUtility {

	public static BrokerRequest getBrokerRequest(String respString) {
		HashMap classMap = new HashMap();
		classMap.put(Broker.PARAMETERS, HashMap.class);
		
		JsonConfig jCfg = new JsonConfig();
		jCfg.setRootClass(BrokerRequest.class);
		jCfg.setClassMap(classMap);
		return (BrokerRequest)JSONObject.toBean(JSONObject.fromObject(respString), jCfg);
	}

}
